<template>
    <div class="panel minh_624">
        <div class="item_title pr">
            积分任务
        </div>
        <div>
            <div class="myPoints__main">
                <div class="myPoints__main__info">
                    <p>您当前的积分：<span class="ac_list__status">{{infoData.u_integral}}</span></p>
                </div>
            </div>
            <p class="myPoints__main__list__block__title">日常任务</p>
            <div class="myPoints__main__list__block__item">
                <el-row>
                    <el-col :span="2">
                        <div class="myPoints__main__list__block__item__logo myPoints__main__list__block__item__logo--success">每</div>
                    </el-col>
                    <el-col :span="16">
                        <div class="myPoints__main__list__block__item__description">
                            <span>每日签到</span>
                            <span>签到获取积分，你与成功只差一个签到的距离，坚持每日签到，从现在做起</span>
                        </div>
                    </el-col>
                    <el-col :span="3">
                        <div class="myPoints__main__list__block__item__points text-right">
                            <span style="font-size: 20px;">+{{jfData.s_check_score}}</span>
                            <span style="font-size: 14px;">积分</span>
                        </div>
                    </el-col>
                    <el-col :span="3">
                        <div class="myPoints__main__list__block__item__btn text-center">
                            <p v-show="jfData.type == 1"><img src="../../../assets/images/icon_success.png" width="24" />已完成</p>
                            <a v-show="jfData.type == 2" style="color: #169bd5;font-size: 15px;padding-left: 25px;cursor: pointer;" @click="getjf">签到</a>
                        </div>
                    </el-col>
                </el-row>
            </div>
        </div>
    </div>
</template>
<script>

    export default {
        data(){
            return{
                infoData: {},
                jfData: {},
            }
        },
        methods: {
            init(){

                var _this = this;
                //个人信息     获取积分
                this.$httpGet('/api/index/Personal_center/enterpriseInfo',{
                    'u_id': window.localStorage.uid,
                }).then(response => {
                    
                    if(response.code == 200){

                        _this.infoData = response.msg;
                        
                    }else{
                        this.$message({
                            message: response.msg,
                            type: 'warning'
                        });
                    }

                });
                //获取是否签到   与  签到奖励
                this.$httpGet('/api/index/Login/getUserReceivePoints',{
                    'u_id': window.localStorage.uid,
                }).then(response => {
                    
                    if(response.code == 200){

                        _this.jfData = response.msg;
                        
                    }else{
                        this.$message({
                            message: response.msg,
                            type: 'warning'
                        });
                    }

                });
            },
            //签到
            getjf(){
                var _this = this;

                this.$httpGet('/api/index/Login/receivePoints',{
                    'u_id': window.localStorage.uid,
                }).then(response => {
                    
                    if(response.code == 200){

                        this.$message({
                            message: response.msg,
                            type: 'success'
                        });
                        _this.init();
                        
                    }else{
                        this.$message({
                            message: response.msg,
                            type: 'warning'
                        });
                    }

                });
            },
        },
        mounted(){
            this.init();
        },
    }
</script>
